package com.example.controller;

import com.example.pojo.Result;
import com.example.pojo.assProductionPojo;
import com.example.service.basisEditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * ClassName:basisEditController
 * Description:
 *
 * @Author 赵永峰
 * @Create 2024/10/16 18:59
 * @Version 1.0
 */
@RestController
public class basisEditController {
    //装配产量的相关操作
    @Autowired
    private basisEditService basisEditService;
    //插入一条新的装配产量信息
    @PostMapping("/basisEditAddAssProduction")
    public Result basisEditAssProduction(@RequestBody assProductionPojo assProductionPojo){
        basisEditService.basisEditAssProductionInsertOne(assProductionPojo);
        return Result.success();
    }
    //修改一条装配产量数据
    @PostMapping("/basisEditEditAssProduction")
    public Result basisEditEditAssProduction(@RequestBody assProductionPojo assProductionPojo){
        basisEditService.basisEditEditAssProduction(assProductionPojo);
        return Result.success();
    }
    //查询有多少条生产数据
    @GetMapping("/basisQueryAllNumAssProduction")
    public Result basisQueryAllNumAssProduction(){
        Integer num=basisEditService.basisQueryAllNumAssProduction();
        return Result.success(num);
    }
    //分页查询出生产数据
    @PostMapping("/paginationQueryAssProduction")
    public Result paginationQueryAssProduction(@RequestBody Map<String,Object> map){
        List<assProductionPojo> assProductionPojo=basisEditService.paginationQueryAssProduction(map);
        return Result.success(assProductionPojo);
    }
    //根据两个字段，查询出数据，就是一行
    @PostMapping("/towFieldQueryAssProduction")
    public Result towFieldQueryAssProduction(@RequestBody Map<String,Object> map){
        assProductionPojo assProductionPojo=basisEditService.towFieldQueryAssProduction(map);
        return Result.success(assProductionPojo);
    }

}
